﻿/*
--------------------------------------
File: MakeMonochrome.cs
Project: Themaopdracht 7
Author: Maarten Kroon

Description:
A algorithm which creates a monochrome version of the image this is needed after the cropLicensePlateColoured algoritm
--------------------------------------
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Drawing.Imaging;
using System.Runtime.InteropServices;

namespace THO7_Team8
{
    public class MakeMonochrome: ColorInterface
    {
        /// <summary>
        /// Makes the image monochrome, if the pixel color is closer to white then black it becomes white and vice versa
        /// </summary>
        /// <param name="array">A reference to the cropped image array</param>
        public void DoAlgorithm(ref int[] array)
        {       
            for (int i = 0; i < array.Length; i++)
            {
                if (array[i] > -8388608)
                {
                    array[i] = WHITE;
                }
                else
                {
                    array[i] = BLACK;
                }
            }
        }
    }
}






